﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="Dashboard.aspx.cs" Inherits="TimeWork.Dashboard" %>
<%@ Register src="usercontrol/ViewProfile.ascx" tagname="ViewProfile" tagprefix="uc1" %>
<asp:Content ID="Breadcrumb" ContentPlaceHolderID="Bredcrumb" runat="server">
    <li><a href="#" class="report">Trang nhất</a></li>
</asp:Content>
<asp:Content ID="Content_Main" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript">
        function setTimer() {
            var date = new Date();
            document.getElementById('MainContent_hdTime').value = date;
        }

        function ShowTime(d) {
            var inDate = new Date(d);
            dateCurrent = new Date();
  
            var nTotalDiff = dateCurrent.getTime() - inDate.getTime();
            var oDiff = new Object();

            oDiff.hours = Math.floor(nTotalDiff / 1000 / 60 / 60);
            nTotalDiff -= oDiff.hours * 1000 * 60 * 60;
            oDiff.minutes = Math.floor(nTotalDiff / 1000 / 60);
            nTotalDiff -= oDiff.minutes * 1000 * 60;
            oDiff.seconds = Math.floor(nTotalDiff / 1000);
            if (oDiff.hours >= 24) {
                document.getElementById("MainContent_lblHour").innerHTML = "23";
                document.getElementById("MainContent_lblMinute").innerHTML = "59";
                document.getElementById("MainContent_lblSecond").innerHTML = "59";
            }
            else {
                document.getElementById("MainContent_lblHour").innerHTML = oDiff.hours;
                document.getElementById("MainContent_lblMinute").innerHTML = oDiff.minutes;
                document.getElementById("MainContent_lblSecond").innerHTML = oDiff.seconds;
            }
            var timeout = window.setTimeout("ShowTime('" + d + "')", 1000);
        }

        function StopTime() {
            if (typeof timeout === 'undefined') {
                // do something
            } else {
                clearTimeout(timeout);
            }
            document.getElementById("MainContent_lblHour").innerHTML = 0;
            document.getElementById("MainContent_lblMinute").innerHTML = 0;
            document.getElementById("MainContent_lblSecond").innerHTML = 0;
        }
    </script>
    <form id="frmStart" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:HiddenField ID="hdTime" runat="server" />
    <asp:Label ID="Label1" runat="server"></asp:Label>
    <center><h2>Xin chào <asp:Label ID="lblUser" runat="server"></asp:Label>!</h2></center>
    
    <div class="left" style="float:left;width:665px;">
        <div class="project" style="margin:0 auto;">
            <asp:Literal ID="ltReportedTime" runat="server"></asp:Literal>
        </div>
        <br />
        <div class="project incre" style="margin:0 auto;">
            <asp:Literal ID="ltReportedTimeActivity" runat="server"></asp:Literal>
        </div>
        <br />
        <div class="project incre" style="margin:0 auto;">
            <asp:Literal ID="ltMyProject" runat="server"></asp:Literal>
        </div>
    </div>
    <div class="right" style="float:left;width:265px;">
        <div class="project timer" style="margin:0 auto;">
                <table>
                    <tr><th colspan="3" class='header'>Đồng hồ đo thời gian</th></tr>
                    <tr>
                        <td align="center" class="time">Giờ</td>
                        <td align="center" class="time">Phút</td>
                        <td align="center" class="time">Giây</td>
                    </tr>
                    <tr>
                        <td align="center" class="time value"><asp:Label ID="lblHour" runat="server" Text="0"></asp:Label> </td>
                        <td align="center" class="time value"><asp:Label ID="lblMinute" runat="server" Text="0"></asp:Label> </td>
                        <td align="center" class="time value"><asp:Label ID="lblSecond" runat="server" Text="0"></asp:Label> </td>
                    </tr>
                    <asp:Panel runat="server" ID="pnlStart">
                        <tr>
                            <td colspan="3" align="center">
                                <asp:Button ID="btnStart" runat="server" Text="Bắt đầu" CssClass="mybutton" 
                                onclick="btnStart_Click" OnClientClick="setTimer();" />
                            </td>
                        </tr>
                    </asp:Panel>
                    <asp:Panel runat="server" ID="pnlStop">
                        <tr>
                            <td colspan="3" align="center">
                                <asp:Button ID="btnRegister" runat="server" Text="Đăng ký thời gian" CssClass="mybutton" 
                                 onclick="btnRegister_Click" /><br />
                                 <asp:Button ID="btnCancel" runat="server" Text="Hủy bỏ" CssClass="mybutton color-yellow" 
                                 onclick="btnCancel_Click" />
                            </td>
                        </tr>
                    </asp:Panel>
                    
                </table>
            
        </div>
        <br />
        <div class="project dem" style="margin:0 auto;">
            <asp:Literal ID="ltWeekend" runat="server"></asp:Literal>
        </div>
    </div>
    
    <!-- Panel hidden--> 
    
    <asp:Panel ID="pnlOverlay" runat="server" Visible="false">      
        <div class="info-box popup">
            <h3>Đăng ký thời gian</h3>
            <table style="width: 440px;">
                <tr>
                    <td class="tdLabel">Ngày tháng:</td>
                    <td><asp:Label ID="lblDate" runat="server"></asp:Label></td>
                </tr>
                <tr>
                    <td class="tdLabel">Thời gian bắt đầu:</td>
                    <td><asp:Label ID="lblTime" runat="server"></asp:Label></td>
                </tr>                     
                <tr>
                    <td colspan="2">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate> 
                                <span style="padding-left: 57px;font-style: italic;">Chọn sản phẩm:</span>&nbsp;&nbsp;&nbsp;&nbsp;<asp:DropDownList ID="ddlProject" runat="server" Width="200px" 
                                AutoPostBack="True" onselectedindexchanged="ddlProject_SelectedIndexChanged">
                                </asp:DropDownList><br /><br />
                                <span style="padding-left: 61px;font-style: italic;">Chọn công việc:</span>&nbsp;&nbsp;&nbsp;&nbsp;<asp:DropDownList ID="ddlActivity" runat="server" Width="200px">
                                </asp:DropDownList>  
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td class="tdLabel">Thời gian:</td>
                    <td>
                        <asp:DropDownList ID="ddlHour" runat="server" CssClass="round-border">
                                <asp:ListItem>0</asp:ListItem>
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                                <asp:ListItem>5</asp:ListItem>
                                <asp:ListItem>6</asp:ListItem>
                                <asp:ListItem>7</asp:ListItem>
                                <asp:ListItem>8</asp:ListItem>
                                <asp:ListItem>9</asp:ListItem>
                                <asp:ListItem>10</asp:ListItem>
                                <asp:ListItem>11</asp:ListItem>
                                <asp:ListItem>12</asp:ListItem>
                                <asp:ListItem>13</asp:ListItem>
                                <asp:ListItem>14</asp:ListItem>
                                <asp:ListItem>15</asp:ListItem>
                                <asp:ListItem>16</asp:ListItem>
                                <asp:ListItem>17</asp:ListItem>
                                <asp:ListItem>18</asp:ListItem>
                                <asp:ListItem>19</asp:ListItem>
                                <asp:ListItem>20</asp:ListItem>
                                <asp:ListItem>21</asp:ListItem>
                                <asp:ListItem>22</asp:ListItem>
                                <asp:ListItem>23</asp:ListItem>
                            </asp:DropDownList> giờ&nbsp;
                        <asp:DropDownList ID="ddlMinute" runat="server" CssClass="round-border">
                                <asp:ListItem>0</asp:ListItem>
                                <asp:ListItem>5</asp:ListItem>
                                <asp:ListItem>10</asp:ListItem>
                                <asp:ListItem>15</asp:ListItem>
                                <asp:ListItem>20</asp:ListItem>
                                <asp:ListItem>25</asp:ListItem>
                                <asp:ListItem>30</asp:ListItem>
                                <asp:ListItem>35</asp:ListItem>
                                <asp:ListItem>40</asp:ListItem>
                                <asp:ListItem>45</asp:ListItem>
                                <asp:ListItem>50</asp:ListItem>
                                <asp:ListItem>55</asp:ListItem>
                            </asp:DropDownList> phút
                    </td>
                </tr>
                <tr>
                    <td class="tdLabel">Loại thời giờ:</td>
                    <td>
                        <asp:DropDownList ID="ddlTypeTime" runat="server">
                        </asp:DropDownList> </td>
                </tr>
                <tr>
                    <td class="tdLabel">Ghi chú:</td>
                    <td><asp:TextBox ID="txtCommentTime" runat="server" TextMode="MultiLine"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="tdLabel">Tùy chọn:</td>
                    <td>
                        <asp:RadioButton ID="rbStop" runat="server" Text="Tắt đồng hồ đếm" GroupName="option" Checked="true" /> <br />
                        <asp:RadioButton ID="rbRestart" runat="server" Text="Reset đồng hồ đếm" GroupName="option"/>
                    </td>       
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <asp:Label ID="lblError" runat="server" Font-Italic="True" ForeColor="Maroon"></asp:Label></td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <asp:Button ID="btnRegisterTime" runat="server" Text="Đăng ký" 
                            CssClass="mybutton" onclick="btnRegisterTime_Click" OnClientClick="setTimer();"
                                />&nbsp;<asp:Button 
                            ID="btnClose" runat="server" Text="Hủy bỏ" CssClass="mybutton color-red" 
                            onclick="btnClose_Click" />
                    </td>
                </tr>
            </table>
        </div>  
    </asp:Panel>
    </form>
</asp:Content>
